/**
 * @file asist
 * @author liaoxuezhi@baidu.com
 */
/* eslint fecs-indent: [0, "space", 2, 2] */

import {
  SET_ASIDE_FOLDED,
  TOGGLE_ASIDE_FOLDED,
  TOGGLE_ASIDE_NAV_OPEN,
  TOGGLE_HEADER_NAV_OPEN,
  SEND_NOTIFY,
  REMOVE_NOTIFY
} from '../util/constants';
import * as assign from 'object-assign';
import {createAction} from 'redux-actions';

export const setAsideFolded = createAction(SET_ASIDE_FOLDED);
export const appToggleAsideFolded = createAction(TOGGLE_ASIDE_FOLDED);
export const appToggleAsideNavOpen = createAction(TOGGLE_ASIDE_NAV_OPEN);
export const appToggleHeaderNavOpen = createAction(TOGGLE_HEADER_NAV_OPEN);

let notifyUid = 3000;
export const sendNotify = createAction(SEND_NOTIFY, payload => {
  if (typeof payload === 'string') {
    payload = {
      message: payload
    };
  }

  return assign({
    level: 'info',
    title: '提示',
    uid: notifyUid++
  }, payload);
});
export const removeNotify = createAction(REMOVE_NOTIFY);
